//
//  ReportViewController.m
//  Hxcsfw
//
//  Created by 企友软mac on 2017/10/26.
//  Copyright © 2017年 企友软mac. All rights reserved.
//

#import "ReportViewController.h"
#import "ReportCell.h"
#import "WWebViewController.h"
#import "ReportVideoModel.h"
#import "ReportArticleModel.h"
#import "ReportIICell.h"
#import "ReportIIICell.h"
#import "UIImageView+WebCache.h"
#import "VideoDetailViewController.h"
#import "WTabBar.h"
#import "ReportMoreViewController.h"
#import "DiagramModel.h"

@interface ReportViewController ()<UITableViewDataSource, UITableViewDelegate,ReportCellDelegate,ReportIICellDelegate,ReportIIICellDelegate> {
    NSString *strBtn;
}

@property (nonatomic, strong)UITableView *tableView;
@property (nonatomic, strong)NSMutableArray *arrVideo;
@property (nonatomic, strong)NSMutableArray *arrArticle;
@property (nonatomic, strong)NSMutableArray *arrNormal;
@property (nonatomic, strong)NSMutableArray *arrScale;

@property (nonatomic, strong)NSDictionary *dicRdgz;

@end

@implementation ReportViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    if ([WShareUtil sharedData].dicSleSymbol) {
        if ([[WShareUtil sharedData].dicSleSymbol[@"symbol"] isEqualToString:Report_Symbol]) {
            for (int i = 0; i < self.arrVideo.count; i++) {
                if ([[WShareUtil sharedData].dicSleSymbol[@"id"] isEqualToString:[self.arrVideo[i] strId]]) {

                    ReportVideoModel *videoModel = self.arrVideo[i];
                    if ([[WShareUtil sharedData].dicSleSymbol[@"chosen"] boolValue]) {
                        videoModel.chosen = @"1";
                    }
                    [self.arrVideo replaceObjectAtIndex:i withObject:videoModel];

                    [self.tableView reloadData];
                    [WShareUtil sharedData].dicSleSymbol = nil;
                }
            }
        }
    }

    if ([WShareUtil sharedData].dicBuySymbol) {
        for (int i = 0; i < self.arrVideo.count; i++) {
            if ([[WShareUtil sharedData].dicBuySymbol[@"id"] isEqualToString:[self.arrVideo[i] strId]]) {

                ReportVideoModel *videoModel = self.arrVideo[i];
                if ([[WShareUtil sharedData].dicBuySymbol[@"boughten"] boolValue]) {
                    videoModel.boughten = @"1";
                }
                [self.arrVideo replaceObjectAtIndex:i withObject:videoModel];

                [self.tableView reloadData];
                [WShareUtil sharedData].dicBuySymbol = nil;
            }
        }
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];

    _arrVideo = [NSMutableArray array];
    _arrArticle = [NSMutableArray array];
    _arrNormal = [NSMutableArray array];
    _arrScale = [NSMutableArray array];

    [self.view addSubview:self.tableView];
    [self.tableView.superview insertSubview:[UIView new] atIndex:0];

    [self reportVcDataArticleRequest:@"rdgz"];

    [self reportVcDataVideoRequest:@"bbtb"];
    [self reportVcDataArticleRequest:@"bbtb"];
    [self reportVcTaxpayDataRequest:@"26"];
    [self reportVcTaxpayDataRequest:@"27"];

//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(noWifiRefershingEnd) name:NOREFRESH object:nil];

//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notifyRequestListData) name:HOME_REPORT_NOTIFY object:nil];
}

//- (void)noWifiRefershingEnd {
//    [self.tableView.header endRefreshing];
//}

//- (void)notifyRequestListData{
//    self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
//        [self reportVcDataVideoRequest:@"bbtb"];
//        [self reportVcDataArticleRequest:@"bbtb"];
//    }];
//}

- (UITableView *)tableView {
    if (_tableView == nil) {
        
        if (XIPHONE) {
//            _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WSCREENH_WIDTH, WSCREENH_HEIGHT - 64 - 44 - 49 - 30) style:UITableViewStylePlain];
            _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 64 + 30, WSCREENH_WIDTH, WSCREENH_HEIGHT - 64 - 30) style:UITableViewStylePlain];
        }else{
//            _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WSCREENH_WIDTH, WSCREENH_HEIGHT - 64 - 44 - 49 ) style:UITableViewStylePlain];
            _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 64, WSCREENH_WIDTH, WSCREENH_HEIGHT - 64) style:UITableViewStylePlain];
        }
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.showsVerticalScrollIndicator = NO;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;//去掉横线
    }
    return _tableView;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    if (indexPath.section == 0) {
        return 185;
    } else if (indexPath.section == 1) {
        
        if (self.arrArticle.count < 3) {
            return 180;
        }else{
            return 215;
        }
    }
    return 410;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ReportCell"];

    if (indexPath.section == 0) {
        if (cell == nil) {
            ReportCell *reportCell = [[[NSBundle mainBundle] loadNibNamed:@"ReportCell" owner:self options:nil] lastObject];
            reportCell.lbTitle.text = self.dicRdgz[@"title"];
            reportCell.delegate = self;
            cell = reportCell;
        }
    }else if (indexPath.section == 1) {
        if (cell == nil) {
            
            ReportIICell *reportIICell = [[[NSBundle mainBundle] loadNibNamed:@"ReportIICell" owner:self options:nil] lastObject];
            reportIICell.imgShow.clipsToBounds = YES;
            UIView *lineView = [[UIView alloc] init];
            if (iPhone6_6s) {
                lineView.frame = CGRectMake(17, 38, WSCREENH_WIDTH * 0.16, 3);
            }else if (iPhone6Plus_6sPlus) {
                lineView.frame = CGRectMake(19, 38, WSCREENH_WIDTH * 0.16, 3);
            }else if (XIPHONE) {
                lineView.frame = CGRectMake(17, 38, WSCREENH_WIDTH * 0.17, 3);
            }else if (iPhone5SE){
                lineView.frame = CGRectMake(13, 38, WSCREENH_WIDTH * 0.17, 3);
            }else{
                lineView.frame = CGRectMake(13, 38, WSCREENH_WIDTH * 0.17, 3);
            }
            lineView.backgroundColor = [UIColor redColor];
            if ([strBtn isEqualToString:@"bbtb"]) {
                [reportIICell.btnForm setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
                [reportIICell.btnForm addSubview:lineView];
            }else if ([strBtn isEqualToString:@"sbhz"]) {
                [reportIICell.btnHandle setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
                [reportIICell.btnHandle addSubview:lineView];

            }else if ([strBtn isEqualToString:@"bbdy"]) {
                [reportIICell.btnPrint setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
                [reportIICell.btnPrint addSubview:lineView];
            }

            if (self.arrVideo.count > 0 && self.arrVideo) {
                [reportIICell.imgShow sd_setImageWithURL:[NSURL URLWithString:[self.arrVideo[0] imgsrc]] placeholderImage:[UIImage imageNamed:@"report_image.png"]];
                reportIICell.lbShow.text = [self.arrVideo[0] strTitle];
                reportIICell.lbShowNum.text = [NSString stringWithFormat:@"%@人学习过",[self.arrVideo[0] strView]];

                if ([[_arrVideo[0] chosen] boolValue]) {
                    reportIICell.lbType.hidden = NO;
                    reportIICell.lbType.text = @"已选课";
                    reportIICell.lbType.backgroundColor = WRGBColor(235, 107, 12);
                } else if (![[_arrVideo[0] chosen] boolValue] && [[_arrVideo[0] boughten] boolValue]) {
                    reportIICell.lbType.hidden = NO;
                    reportIICell.lbType.text = @"已购买";
                    reportIICell.lbType.backgroundColor = WRGBColor(208, 45, 39);
                }

                if (self.arrVideo.count > 1) {
                    reportIICell.lbVideo.text = [self.arrVideo[1] strTitle];
                    reportIICell.lbVideoTime.text = [self.arrVideo[1] fbsj];
                }
            }
            
            if (self.arrArticle.count > 0 && self.arrArticle && self.arrArticle.count <= 3) {

                reportIICell.lbAsk.text = [self.arrArticle[0] strTitle];
                reportIICell.lbAskTime.text = [self.arrArticle[0] fbsj];

                reportIICell.lbVideo.text = [self.arrArticle[1] strTitle];
                reportIICell.lbVideoTime.text = [self.arrArticle[1] fbsj];

                reportIICell.lbAskII.text = [self.arrArticle[2] strTitle];
                reportIICell.lbAskIITime.text = [self.arrArticle[2] fbsj];
            }
            if (self.arrArticle.count > 0 && self.arrArticle && self.arrArticle.count <= 2) {
                
                reportIICell.lbAsk.text = [self.arrArticle[0] strTitle];
                reportIICell.lbAskTime.text = [self.arrArticle[0] fbsj];
                
                reportIICell.lbVideo.text = [self.arrArticle[1] strTitle];
                reportIICell.lbVideoTime.text = [self.arrArticle[1] fbsj];
                
            }
            if (self.arrArticle.count > 0 && self.arrArticle && self.arrArticle.count <= 1) {
                
                reportIICell.lbAsk.text = [self.arrArticle[0] strTitle];
                reportIICell.lbAskTime.text = [self.arrArticle[0] fbsj];
                
            }
            
            reportIICell.delegate = self;
            cell = reportIICell;
        }
    }else {
        if (cell == nil) {
            ReportIIICell *reportIIICell = [[[NSBundle mainBundle] loadNibNamed:@"ReportIIICell" owner:self options:nil] lastObject];

            if (self.arrNormal.count > 0 && self.arrNormal) {
                reportIIICell.lbNormalI.text = [self.arrNormal[0] strTitle];
                reportIIICell.lbNormalII.text = [self.arrNormal[1] strTitle];
                reportIIICell.lbNormalIII.text = [self.arrNormal[2] strTitle];
                reportIIICell.lbNormalIV.text = [self.arrNormal[3] strTitle];
            }

            if (self.arrScale.count > 0 && self.arrScale) {
                reportIIICell.lbScaleI.text = [self.arrScale[0] strTitle];
                reportIIICell.lbScaleII.text = [self.arrScale[1] strTitle];
                reportIIICell.lbScaleIII.text = [self.arrScale[2] strTitle];
                reportIIICell.lbScaleIV.text = [self.arrScale[3] strTitle];
            }
            reportIIICell.delegate = self;
            cell = reportIIICell;
        }
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}

- (void)delegatBtnClick:(UIButton *)button {
    if (button.tag == 1000) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = self.dicRdgz[@"title"];
        webVc.shareTitle = self.dicRdgz[@"title"];//分享标题
        webVc.strUrl = self.dicRdgz[@"link"];
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 2000) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"用户注册";
        webVc.shareTitle = @"用户注册";//分享标题
        webVc.strUrl = YHZC_URL;
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 2001) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"用户登录";
        webVc.shareTitle = @"用户登录";//分享标题
        webVc.strUrl = YHDL_URL;
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 2002) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"进行申报";
        webVc.shareTitle = @"进行申报";//分享标题
        webVc.strUrl = JXSB_URL;
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 2003) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"报表打印";
        webVc.shareTitle = @"报表打印";//分享标题
        webVc.strUrl = BBDY_URL;
        [self.navigationController pushViewController:webVc animated:YES];
    }
}

- (void)delegatReportIIBtnClick:(UIButton *)button {
    if (button.tag == 3000) {
        [self reportVcDataVideoRequest:@"bbtb"];
        [self reportVcDataArticleRequest:@"bbtb"];
    }else if (button.tag == 3001) {
        [self reportVcDataVideoRequest:@"sbhz"];
        [self reportVcDataArticleRequest:@"sbhz"];
    }else if (button.tag == 3002) {
        [self reportVcDataVideoRequest:@"bbdy"];
        [self reportVcDataArticleRequest:@"bbdy"];
    }else if (button.tag == 3003) {
        self.tabBarController.selectedIndex = 2;
        [WShareUtil sharedData].strLevel = @"sb";
        [WShareUtil sharedData].strLevel2 = @"tech";
        [[NSNotificationCenter defaultCenter] postNotificationName:@"dd" object:nil userInfo:@{@"strLevel":@"sb",@"strLevel2":@"tech"}];
        WTabBar *wtabBar = (WTabBar *)self.tabBarController.tabBar;
//        [wtabBar.plusBtn setBackgroundImage:[UIImage imageNamed:@"WB_XZ@2x.png"] forState:UIControlStateNormal];
        [wtabBar.plusBtn setImage:[UIImage imageNamed:@"WB_XZ@2x.png"] forState:UIControlStateNormal];
        [self.navigationController popToRootViewControllerAnimated:YES];

    }else if (button.tag == 3004) {//第一条视频不传分享参数
        VideoDetailViewController *videoDetailVc = [[VideoDetailViewController alloc]init];
        if (self.arrVideo != nil && self.arrVideo.count > 0) {
            videoDetailVc.strId = [self.arrVideo[0] strId];
        }
        videoDetailVc.symbol = Report_Symbol;
        [self.navigationController pushViewController:videoDetailVc animated:YES];
    }else if (button.tag == 3005) {//二条

        if (self.arrArticle == nil || self.arrArticle.count <= 0) {
            return;
        }
        if ([[self.arrArticle[0] strType] isEqualToString:@"vedio"]) {
            VideoDetailViewController *videoDetailVc = [[VideoDetailViewController alloc]init];
            videoDetailVc.strId = [self.arrArticle[0] strId];
            videoDetailVc.symbol = Report_Symbol;
            [self.navigationController pushViewController:videoDetailVc animated:YES];
        } else {
            WWebViewController *webVc = [[WWebViewController alloc] init];
            webVc.strTitle = @"申报问吧";
            
            webVc.shareTitle = [self.arrArticle[0] strTitle];//分享标题
            webVc.strID = [self.arrArticle[0] strId];//分享ID
            webVc.strType = @"wz";//分享类型文章
            
            webVc.strUrl = [self.arrArticle[0] link];
            [self.navigationController pushViewController:webVc animated:YES];
        }
    }else if (button.tag == 3006) {//三条
        if (self.arrArticle == nil || self.arrArticle.count <= 0) {
            return;
        }
        if ([[self.arrArticle[1] strType] isEqualToString:@"vedio"]) {
            VideoDetailViewController *videoDetailVc = [[VideoDetailViewController alloc]init];
            videoDetailVc.strId = [self.arrArticle[1] strId];
            videoDetailVc.symbol = Report_Symbol;
            [self.navigationController pushViewController:videoDetailVc animated:YES];
        } else {
            WWebViewController *webVc = [[WWebViewController alloc] init];
            webVc.strTitle = @"申报问吧";
            
            webVc.shareTitle = [self.arrArticle[1] strTitle];//分享标题
            webVc.strID = [self.arrArticle[1] strId];//分享ID
            webVc.strType = @"wz";//分享类型文章
            
            webVc.strUrl = [self.arrArticle[1] link];
            [self.navigationController pushViewController:webVc animated:YES];
        }
    }else if (button.tag == 3007) {//四条
        if (self.arrArticle == nil || self.arrArticle.count <= 0) {
            return;
        }
        if ([[self.arrArticle[2] strType] isEqualToString:@"vedio"]) {
            VideoDetailViewController *videoDetailVc = [[VideoDetailViewController alloc]init];
            videoDetailVc.strId = [self.arrArticle[2] strId];
            videoDetailVc.symbol = Report_Symbol;
            [self.navigationController pushViewController:videoDetailVc animated:YES];
        } else {
            WWebViewController *webVc = [[WWebViewController alloc] init];
            webVc.strTitle = @"申报问吧";
            
            webVc.shareTitle = [self.arrArticle[2] strTitle];//分享标题
            webVc.strID = [self.arrArticle[2] strId];//分享ID
            webVc.strType = @"wz";//分享类型文章
            
            webVc.strUrl = [self.arrArticle[2] link];
            [self.navigationController pushViewController:webVc animated:YES];
        }
    }
}

- (void)delegatReportIIIBtnClick:(UIButton *)button {

    if (button.tag == 4000) {

        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"一般纳税人填报指南";
        webVc.strUrl = @"http://www.sx95113.com/wapfww/list?type=tbznyb";
        [self.navigationController pushViewController:webVc animated:YES];
//        ReportMoreViewController *reportMoreVc = [[ReportMoreViewController alloc] init];
//        reportMoreVc.colcode = @"26";
//        [self.navigationController pushViewController:reportMoreVc animated:YES];
    }else if (button.tag == 4001) {
        
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"一般纳税人";
        if (self.arrNormal != nil && self.arrNormal.count > 0) {
            webVc.shareTitle = [self.arrNormal[0] strTitle];//分享标题
            webVc.strID = [self.arrNormal[0] strId];//分享ID
            webVc.strUrl = [self.arrNormal[0]link];
        }
        webVc.strType = @"wz";//分享类型文章
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 4002) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"一般纳税人";

        if (self.arrNormal != nil && self.arrNormal.count > 0) {
            webVc.shareTitle = [self.arrNormal[1] strTitle];//分享标题
            webVc.strID = [self.arrNormal[1] strId];//分享ID
            webVc.strUrl = [self.arrNormal[1]link];
        }
        webVc.strType = @"wz";//分享类型文章
        
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 4003) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"一般纳税人";

        if (self.arrNormal != nil && self.arrNormal.count > 0) {
            webVc.shareTitle = [self.arrNormal[2] strTitle];//分享标题
            webVc.strID = [self.arrNormal[2] strId];//分享ID
            webVc.strUrl = [self.arrNormal[2]link];

        }

        webVc.strType = @"wz";//分享类型文章
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 4004) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"一般纳税人";

        if (self.arrNormal != nil && self.arrNormal.count > 0) {
            webVc.shareTitle = [self.arrNormal[3] strTitle];//分享标题
            webVc.strID = [self.arrNormal[3] strId];//分享ID
            webVc.strUrl = [self.arrNormal[3]link];
        }

        webVc.strType = @"wz";//分享类型文章
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 5000) {

        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"小规模纳税人填报指南";
        webVc.strUrl = @"http://www.sx95113.com/wapfww/list?type=tbznxgm";
        [self.navigationController pushViewController:webVc animated:YES];
//        ReportMoreViewController *reportMoreVc = [[ReportMoreViewController alloc] init];
//        reportMoreVc.colcode = @"27";
//        [self.navigationController pushViewController:reportMoreVc animated:YES];
    }else if (button.tag == 5001) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"小规模纳税人";

        if (self.arrScale != nil && self.arrScale.count > 0) {
            webVc.shareTitle = [self.arrScale[0] strTitle];//分享标题
            webVc.strID = [self.arrScale[0] strId];//分享ID
            webVc.strUrl = [self.arrScale[0]link];
        }

        webVc.strType = @"wz";//分享类型文章
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 5002) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"小规模纳税人";

        if (self.arrScale != nil && self.arrScale.count > 0) {
            webVc.shareTitle = [self.arrScale[1] strTitle];//分享标题
            webVc.strID = [self.arrScale[1] strId];//分享ID
            webVc.strUrl = [self.arrScale[1]link];
        }
        webVc.strType = @"wz";//分享类型文章
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 5003) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"小规模纳税人";

        if (self.arrScale != nil && self.arrScale.count > 0) {
            webVc.shareTitle = [self.arrScale[2] strTitle];//分享标题
            webVc.strID = [self.arrScale[2] strId];//分享ID
            webVc.strUrl = [self.arrScale[2]link];

        }

        webVc.strType = @"wz";//分享类型文章
        [self.navigationController pushViewController:webVc animated:YES];
    }else if (button.tag == 5004) {
        WWebViewController *webVc = [[WWebViewController alloc] init];
        webVc.strTitle = @"小规模纳税人";

        if (self.arrScale != nil && self.arrScale.count > 0) {
            webVc.shareTitle = [self.arrScale[3] strTitle];//分享标题
            webVc.strID = [self.arrScale[3] strId];//分享ID
            webVc.strUrl = [self.arrScale[3]link];
        }

        webVc.strType = @"wz";//分享类型文章
        
        [self.navigationController pushViewController:webVc animated:YES];
    }
}

//申报视频请求
- (void)reportVcDataVideoRequest:(NSString *)recommend {

    strBtn = recommend;
    NSDictionary *parametersDict = @{@"mode":@"native",@"service":@"train",@"content":@{@"revert":@"list",@"recommend":recommend,@"num":@"1"}};
    NSString *secret = [NSString stringWithFormat:@"%@",[WHttpTool convertToJsonData:parametersDict]];
    NSDictionary *paramsDic = @{@"params":[CommonFunc encryptWithText:secret]};


    [WHttpTool POST:[WShareUtil getServerURL:nil] parameters:@{@"params":[CommonFunc encryptWithText:secret]} success:^(id responseObject) {
        WLog(@"------%@",responseObject);
        NSString *responseStr = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
        NSDictionary *JsonDic = [WHttpTool dictionaryWithJsonString:responseStr];
        NSString *messageStr = [JsonDic objectForKey:@"message"];
        NSString *successStr = [JsonDic objectForKey:@"success"];
        // 解密请求回的数据（字典）
        NSString *returnStr = [CommonFunc decryptWithText:messageStr];
        // json字符串转字典
        NSDictionary *returnDic = [WHttpTool dictionaryWithJsonString:returnStr];
        [self.arrVideo removeAllObjects];
        for (NSDictionary *dic in returnDic[@"list"]) {
            ReportVideoModel *videoModel = [ReportVideoModel mj_objectWithKeyValues:dic];
            [self.arrVideo addObject:videoModel];
        }
//        [self noWifiRefershingEnd];
        NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:1];
        [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
      } failure:^(NSError *error) {
//        [self noWifiRefershingEnd];
        WLog(@"失败");
    } showProgress:YES];
}

//申报文章请求
- (void)reportVcDataArticleRequest:(NSString *)recommend {

    NSDictionary *parametersDict = @{@"mode":@"native",@"service":@"fwwb",@"content":@{@"revert":@"list",@"recommend":recommend,@"num":@"3"}};
    NSString *secret = [NSString stringWithFormat:@"%@",[WHttpTool convertToJsonData:parametersDict]];
    NSDictionary *paramsDic = @{@"params":[CommonFunc encryptWithText:secret]};


    [WHttpTool POST:[WShareUtil getServerURL:nil] parameters:@{@"params":[CommonFunc encryptWithText:secret]} success:^(id responseObject) {
        WLog(@"------%@",responseObject);
        NSString *responseStr = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
        NSDictionary *JsonDic = [WHttpTool dictionaryWithJsonString:responseStr];
        NSString *messageStr = [JsonDic objectForKey:@"message"];
        NSString *successStr = [JsonDic objectForKey:@"success"];
        // 解密请求回的数据（字典）
        NSString *returnStr = [CommonFunc decryptWithText:messageStr];
        // json字符串转字典
        NSDictionary *returnDic = [WHttpTool dictionaryWithJsonString:returnStr];

        if ([recommend isEqualToString:@"rdgz"]) {
            self.dicRdgz = returnDic[@"list"][0];
            NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:0];
            [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
        } else {
            [self.arrArticle removeAllObjects];
            for (NSDictionary *dic in returnDic[@"list"]) {
                ReportArticleModel *articleModel = [ReportArticleModel mj_objectWithKeyValues:dic];
                [self.arrArticle addObject:articleModel];
            }
            NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:1];
            [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
        }
//        [self noWifiRefershingEnd];

    } failure:^(NSError *error) {
//        [self noWifiRefershingEnd];
        WLog(@"失败");
    } showProgress:YES];
}

- (void)reportVcTaxpayDataRequest:(NSString *)colcode{
    
    NSDictionary *parametersDict = @{@"mode":@"native",@"service":@"xxfb",@"content":@{@"revert":@"list",@"colcode":colcode,@"num":@"4"}};
    NSString *secret = [NSString stringWithFormat:@"%@",[WHttpTool convertToJsonData:parametersDict]];
    NSDictionary *paramsDic = @{@"params":[CommonFunc encryptWithText:secret]};


    [WHttpTool POST:[WShareUtil getServerURL:nil] parameters:@{@"params":[CommonFunc encryptWithText:secret]} success:^(id responseObject) {
        WLog(@"------%@",responseObject);
        NSString *responseStr = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
        NSDictionary *JsonDic = [WHttpTool dictionaryWithJsonString:responseStr];
        NSString *messageStr = [JsonDic objectForKey:@"message"];
        NSString *successStr = [JsonDic objectForKey:@"success"];
        // 解密请求回的数据（字典）
        NSString *returnStr = [CommonFunc decryptWithText:messageStr];
        // json字符串转字典
        NSDictionary *returnDic = [WHttpTool dictionaryWithJsonString:returnStr];

        if ([colcode isEqualToString:@"26"]) {
            for (NSDictionary *dic in returnDic[@"list"]) {
                DiagramModel *diagramModel = [DiagramModel mj_objectWithKeyValues:dic];
                [self.arrNormal addObject:diagramModel];
            }
        } else {
            for (NSDictionary *dic in returnDic[@"list"]) {
                DiagramModel *diagramModel = [DiagramModel mj_objectWithKeyValues:dic];
                [self.arrScale addObject:diagramModel];
            }
        }
        NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2];
        [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
    } failure:^(NSError *error) {
        WLog(@"失败");
    } showProgress:YES];
}

@end
